IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityQueryExtensions Class > Include Method : Include<TQuery>(TQuery,String) Method |
'Declaration
<ExtensionAttribute()> Public Overloads Shared Function Include(Of TQuery As ITypedEntityQuery)( _ ByVal query As TQuery, _ ByVal propertyPath As String _ ) As TQuery
'Usage
Dim query As TQuery Dim propertyPath As String Dim value As TQuery value = EntityQueryExtensions.Include(Of TQuery)(query, propertyPath)
[Extension()] public static TQuery Include<TQuery>( TQuery query, string propertyPath ) where TQuery: ITypedEntityQuery
Multiple "Includes" may be added to a query.
DomainModelEntityManager mgr = new DomainModelEntityManager(); // Query for some customers, and include their orders and details in query. var query1 = mgr.Customers .Where(c => c.Id < 5) .Include("OrderSummaries.OrderDetails"); foreach (Customer c in query1) { Console.WriteLine("order count = " + c.OrderSummaries.Count); } // Query for orders including details where the customer is in London var query2 = mgr.OrderSummaries.Include("OrderDetails") .Where(c => c.Customer.City == "London"); var results = query2.ToList();
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2